/**
  ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFVDC
  \brief virtual class for DCs in general - just for abstraction
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-11-01
  \date 2021-11-30 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-11-01   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFVDC_h
#define ETFVDC_h

#include "ETFDetector.h"
#include "TrackType.h"

class TClonesArray;
class ETFHPTDCChannel;
class ETFVTrack;
class ETFDCHit;

class ETFVDC : public ETFDetector{
public:
  ETFVDC(){}
  ETFVDC(const char *name);
  virtual ~ETFVDC();

  void SetDCId(int id){ fDCId = id; }
  /// r = r(t); drift distance - drift time relation
  virtual double SpaceTimeRelation(double t) = 0;
  /// \retval false: if obtained drift time out of range
  /// NOTE that if trk has non-FitStatus::kUNFITTED FitStatus, this method
  /// would do nothing, as drift distance only changes with drift time,
  /// whose changes would ensure fFitStatus be set to FitStatus::kUNFITTED
  virtual bool SetDriftDistance(ETFVTrack *trk) = 0;
  /// set the wire's projection to its normal plane
  virtual void SetHitProjection(ETFDCHit *h, DCType typeDC) = 0;

  /// get the fired sense wire layer
  /// \param type: XUV or XY; x12: X1 or X2
  virtual TClonesArray *GetHitsArray(DCType type, int x12) = 0;
  short GetDCId() const{ return fDCId; }
  virtual int Multi(DCType type, int x12); // \return multiplicity of the wire layer
  int GetNL() const{ return NL; }

  ClassDef(ETFVDC, 1);

protected:
  /// \param wireId: 0-159, along x increasing direction
  /// \param type: 0-1-2: X-U-V or X-Y--
  virtual void AddHit(const ETFHPTDCChannel *ch, int wireId, DCType type) = 0;

  short fDCId; ///< drift chamber id: along beam direction
  int NL; ///< number of signal wires per layer
};

#endif
